#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) JoinQuant Development Team
# Author: Huayong Kuang <kuanghuayong@joinquant.com>

from flask import Flask, request, session, make_response


app = Flask(__name__)
app.secret_key = "123456"


@app.route("/")
def index():
    print("------", request.cookies)
    if not session.get("s1"):
        print("set session ........")
        session["s1"] = "blabla..."
    print("--- session", session.get("s1"))
    resp = make_response("Hello")
    resp.set_cookie('test1', 'I am cookie')
    resp.set_cookie('test2', '123456')
    return resp


if __name__ == "__main__":
    app.run("0.0.0.0", 8002)
